package com.day02_function;

/**
 * @ClassName: Test01
 * @Author: 豆豆在睡觉
 * @Create 2024/1/14-21:30
 * @Version 1.0
 */
public class Test01 {
    public static void main(String[] args) {
        // 在main中调用
//        isNumber();
        compare(10,30);
        compare(30,12);
        System.out.println(compare(39, 40));
        double sum = sum(20.03, 30.5);
        System.out.println("double sum" + sum);
        int[] arr = {1,2,3,4,5};
        pri(arr);
        reverse(arr);
        pri(arr);

    }
    public static void isNumber() {
        int number = 11;
        // 判断该数据是否是偶数
        if(number % 2 == 0) {
            System.out.println( "number是偶数");
        } else {
            System.out.println("number是奇数");
        }
    }
    public static int compare(int a, int b) {
        if (a >= b) {
            System.out.println("a > b");
        } else {
            System.out.println("a < b");
        }
        return 100;
    }
    public static double sum(double a, double b) {
        return  a +b;
    }
    public static void pri(int[] arr) {
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            if (i == arr.length - 1) {
                System.out.print(arr[i]);
            } else {
                System.out.print(arr[i] + ",");
            }
        }
        System.out.print("]");
    }


    // 反转一个数组
    public static void reverse(int[] arr ) {
        for (int start = 0, end = arr.length - 1; start <= end ; start++, end--) {
            int temp = arr[start];
            arr[start] = arr[end];
            arr[end] = temp;
        }
    }
}
